<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@page import="java.util.*"%>
<%@page import="dyyx.util.*"%>
<%@page import="org.apache.kafka.clients.producer.*"%>
<% 

int topicIndex = WebUtil.getInt(request, "topicIndex");

String key = WebUtil.get(request, "key");
String value = WebUtil.get(request, "value");

if(CommUtil.isBlank(value)){
	value = new Date()+"";
}

String str = "key="+key+",value="+value;
long start = System.currentTimeMillis();

try{
    RecordMetadata meta = KafkaUtil.sendMsg(topicIndex, key, value);
    long end = System.currentTimeMillis();
    long time = end - start;
    RunStatusUtil.logTime("kafkaSendSuccess", time);
    
    str = str+","+meta;
    
}catch(Throwable e){
	long end = System.currentTimeMillis();
    long time = end - start;
    RunStatusUtil.logTime("kafkaSendError", time);
    RunStatusUtil.logError("kafkaSendError", e);
    
    str = str+","+e;

}

%>

<%=str %>







